package com.slx.n_ary_tree_postorder_traversal;

import org.junit.Assert;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import static org.junit.Assert.*;

public class SolutionTest {

    @org.junit.Test
    public void postorder() {
        Solution s = new Solution();

        Node root = new Node(1);
        root.children = new ArrayList<>();
        root.children.add(new Node(3));
        root.children.add(new Node(2));
        root.children.add(new Node(4));
        root.children.get(0).children = new ArrayList<>();
        root.children.get(0).children.add(new Node(5));
        root.children.get(0).children.add(new Node(6));

        List<Integer> result = Arrays.asList(5,6,3,2,4,1);

        Assert.assertEquals(result, s.postorder(root));
    }
}